#-*- coding: utf-8 -*-

def stdoutObserver(*data):
    #s = str(data)[1:-1]
    #print s

    for d in data:
        print(d, end=' ')
    print("")

def stderrObserver(*data):
    import sys
    #s = str(data)[1:-1]
    #print >> sys.stderr, s
    for d in data:
        print(d, end=' ', file=sys.stderr)
    print("", file=sys.stderr)

class FileObserver(object):

    def __init__(self, file):
        self.fileObj = open(file,"a") 

    def __call__(self, *data):
        s = ""
        for d in data:
            s += str(d) + " "

        self.fileObj.write(s + "\n")
    
    def __del__(self):
        self.fileObj.close()

if __name__ == "__main__":
    o = FileObserver("foobar")
    o(1,2,3)
# vim: fdm=marker
